Chooses the palette every draw_text call draws its letters in, from here until it is changed again - ambient state, like font_set and text_align. text_palette(nothing) goes back to the font’s own colors.
Game Boy: not available
Works differently on Game Boy Color - text_palette changes the colors of the letters; the background behind the letters keeps its color.
On other consoles this differs: see Side by side and How the consoles differ.
text_palette(palette)| Name | Type |
|---|---|
palette | palette |
Nothing.
Chooses the palette every draw_text call draws its letters in, from here until it is changed again - ambient state, the same shape font_set and text_align have. text_palette(nothing) goes back to the font's own colors.
It works for every form of draw_text. The palette has to have 16 colors, the kind a font is made of.
A font drawn in a palette counts as a font of its own. A game can draw words in 4 different fonts at once (you can change that in Project Settings, under Engine limits), and the same font in two palettes is two of them (and the same font in its own colors is a third). Each font-and-palette pair keeps its place for the rest of the game, even after a room change, and the checker counts them and warns before the build if a game uses more pairs than there is room for. It also uses one of the console's 16 sprite palettes while a word drawn in it is on screen, and shares it with anything else drawn in the same palette. If there is no room for another font, or no free sprite palette, a development build stops, and a release build draws the words in the font's own colors.
text_palette(pal_doc_gold);
draw_text(8, 8, "SCORE");
text_palette(nothing);
draw_text(8, 24, "ordinary words");The first line is drawn in gold, the second in the font's own colors. Changing the palette between two draw_text calls colors each of them the way it was set when it was called.
The palette has to have 16 colors (the 4-bit kind a font is made of). A font drawn in a palette counts as a font of its own towards the number of fonts draw_text can use (4 unless you change it in Project Settings, under Engine limits): the same font in two palettes uses two. It also uses one of the console’s 16 sprite palettes while a word drawn in it is on screen, and shares it with anything else drawn in the same palette. Words already on screen change colors on the next frame their call is made again. Changing the palette between two draw_text calls in the same event colors each of them the way it was set when it was called. Works for every draw_text variant. If there is no room for another font, or no free sprite palette, a development build stops with a message that says so, and a release build draws the words in the font’s own colors.